//
//  JingxuanModel.m
//  JingXuanTableView
//
//  Created by TianZhen on 16/4/6.
//  Copyright © 2016年 TianZhen. All rights reserved.
//
#import "JingxuanModel.h"

@implementation JingxuanModel

+ (instancetype)modelWithDict:(NSDictionary *)dict
{
    JingxuanModel *model = [[self alloc] init];
    [model setValuesForKeysWithDictionary:dict];
    return model;
}

+ (NSArray *)models
{
    NSArray *array = [NSArray arrayWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"Jingxuan.plist" ofType:nil]];
    
    NSMutableArray *marr = [NSMutableArray array];
    for (NSDictionary *dict in array) {
        
        // 创建模型
        JingxuanModel *model = [JingxuanModel modelWithDict:dict];
        
        NSMutableArray *images = [NSMutableArray arrayWithCapacity:model.images.count];
        // 遍历模型的图片名称数组
        for (NSString *imageName in model.images) {

            UIImage *image = [UIImage imageNamed:imageName];

            [images addObject:image];
        }
        model.images = images;
        
        [marr addObject:model];
    }

    return marr;
}
@end
